<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <div id="app"></div>
  <script src="./renderer.js"></script>

  <script>
    // 通过h函数创建vnode
    const vnode = h("div", { class: "why" }, [
      h("h2", null, "当前计数"),
      h("button", null, "+1")
    ])

    // 通过mount函数，将vnode挂载到div#app
    mount(vnode, document.querySelector("#app"));

    // 创建新的vnode
    const vnode1 = h("div", { class: "coderwhy" }, [
      h("h2", null, "呵呵呵"),
      h("button", null, "-1")
    ]);
    setTimeout(() => {
      patch(vnode, vnode1);
    }, 2000);
  </script>
</body>

</html>